#!/bin/bash

# 目标路径
FILE="/usr/local/bin/cheat"

# 检查文件是否存在
if [ -f "$FILE" ]; then
    echo "$FILE already exists. Skipping installation."
else
    echo "$FILE does not exist. Installing cheat."

    # 下载、解压、设置权限并移动到 /usr/local/bin
    cd /tmp \
    && wget https://github.com/cheat/cheat/releases/download/4.4.2/cheat-linux-amd64.gz \
    && gunzip cheat-linux-amd64.gz \
    && chmod +x cheat-linux-amd64 \
    && sudo mv cheat-linux-amd64 /usr/local/bin/cheat

    # 检查运行状态
    if [ $? -eq 0 ]; then
        echo "cheat installed successfully."
    else
        echo "Failed to install cheat."
    fi
fi
